home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / rpcasync.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  3.2 KB  |  166 lines

  1. /*++
  2.  
  3. Copyright (c) 1997 Microsoft Corporation
  4.  
  5. Module Name:
  6.  
  7.     rpcasync.h
  8.  
  9. Abstract:
  10.  
  11.     This module contains the RPC runtime APIs needed to use
  12.     [async_handle] RPC features.
  13.  
  14. --*/
  15.  
  16. #ifndef __RPCASYNC_H__
  17. #define __RPCASYNC_H__
  18. #pragma option push -b
  19.  
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23.  
  24. #define RPC_ASYNC_VERSION_1_0     sizeof(RPC_ASYNC_STATE)
  25.  
  26. typedef
  27. enum _RPC_NOTIFICATION_TYPES
  28. {
  29.     RpcNotificationTypeNone,
  30.     RpcNotificationTypeEvent,
  31.     RpcNotificationTypeApc, 
  32.     RpcNotificationTypeIoc,
  33.     RpcNotificationTypeHwnd,
  34.     RpcNotificationTypeCallback
  35. } RPC_NOTIFICATION_TYPES;
  36.  
  37. typedef
  38. enum _RPC_ASYNC_EVENT {
  39.     RpcCallComplete,
  40.     RpcSendComplete,
  41.     RpcReceiveComplete
  42.     } RPC_ASYNC_EVENT;
  43.  
  44. typedef void (*PFN_RPCNOTIFICATION_ROUTINE) (
  45.                   struct _RPC_ASYNC_STATE *pAsync,
  46.                   void *Context,                              
  47.                   RPC_ASYNC_EVENT Event);
  48.  
  49. typedef struct _RPC_ASYNC_STATE {
  50.     unsigned int    Size; // size of this structure
  51.     unsigned long   Signature;
  52.              long   Lock;
  53.     unsigned long   Flags;
  54.     void           *StubInfo;
  55.     void           *UserInfo;
  56.     void           *RuntimeInfo;
  57.     RPC_ASYNC_EVENT Event;
  58.  
  59.     RPC_NOTIFICATION_TYPES NotificationType;
  60.     union {
  61.         //
  62.         // Notification by APC
  63.         //
  64.         struct {
  65.             PFN_RPCNOTIFICATION_ROUTINE NotificationRoutine;
  66.             HANDLE hThread;
  67.             } APC;
  68.  
  69.         //
  70.         // Notification by IO completion port
  71.         //
  72.         struct {
  73.             HANDLE hIOPort;
  74.             DWORD dwNumberOfBytesTransferred;
  75.             DWORD dwCompletionKey;
  76.             LPOVERLAPPED lpOverlapped;
  77.             } IOC;
  78.  
  79.         //
  80.         // Notification by window message
  81.         //
  82.         struct {
  83.             HWND hWnd;
  84.             UINT Msg;
  85.             } HWND;
  86.  
  87.  
  88.         //
  89.         // Notification by event
  90.         //
  91.         HANDLE hEvent;
  92.  
  93.         //
  94.         // Notification by callback function
  95.         //
  96.         PFN_RPCNOTIFICATION_ROUTINE NotificationRoutine;
  97.         } u;
  98.  
  99.     long Reserved[4]; 
  100.     } RPC_ASYNC_STATE, *PRPC_ASYNC_STATE;
  101.  
  102. // Possible values for Flags
  103. #define RPC_C_NOTIFY_ON_SEND_COMPLETE      0x1
  104. #define RPC_C_INFINITE_TIMEOUT             INFINITE
  105.  
  106. RPCRTAPI
  107. RPC_STATUS
  108. RPC_ENTRY
  109. RpcInitializeAsyncHandle (
  110.     PRPC_ASYNC_STATE pAsync,
  111.     unsigned int     Size
  112.     );
  113.                       
  114. RPCRTAPI
  115. RPC_STATUS
  116. RPC_ENTRY
  117. RpcRegisterAsyncInfo (
  118.     PRPC_ASYNC_STATE pAsync
  119.     ) ;
  120.  
  121. RPCRTAPI
  122. RPC_STATUS
  123. RPC_ENTRY
  124. RpcGetAsyncCallStatus (
  125.     PRPC_ASYNC_STATE pAsync
  126.     ) ;
  127.  
  128. RPCRTAPI
  129. RPC_STATUS
  130. RPC_ENTRY
  131. RpcCompleteAsyncCall (
  132.     PRPC_ASYNC_STATE pAsync,
  133.     void *Reply
  134.     ) ;
  135.  
  136. RPCRTAPI
  137. RPC_STATUS
  138. RPC_ENTRY
  139. RpcAbortAsyncCall (
  140.     PRPC_ASYNC_STATE pAsync,
  141.     unsigned long ExceptionCode
  142.     ) ;
  143.  
  144.  
  145. //
  146. // Internal APIs
  147. //
  148. RPC_STATUS RPC_ENTRY
  149. I_RpcSetAsyncHandle (
  150.     IN  PRPC_MESSAGE Message,
  151.     IN  PRPC_ASYNC_STATE pAsync
  152.     );
  153.  
  154. RPC_STATUS RPC_ENTRY
  155. I_RpcAbortAsyncCall (
  156.     IN PRPC_ASYNC_STATE pAsync,
  157.     IN unsigned long ExceptionCode
  158.     ) ;
  159.  
  160. #ifdef __cplusplus
  161. }
  162. #endif
  163.  
  164. #pragma option pop
  165. #endif /* __RPCASYNC_H__ */
  166.